import java.util.*;
public class Calculation{
    public static void main(String[] args) {
        Scanner reader=new Scanner(System.in);
        Rational result=new Rational();
        System.out.println("请输入运算式");
        String str=reader.nextLine();
        ChangeExpress change=new ChangeExpress();
        change.setOriginalExpression(str);
        //System.out.println(change.originalExpression);
        change.changedWay();//后缀式化
        //System.out.println(change.changedExpression);
        MyDcRational calculate=new MyDcRational();//后缀式计算
        result=calculate.evaluate(change.changedExpression);
        int a=result.getNumerator();
        int b=result.getDenominator();
        if (b==1){
            System.out.println("result="+a);
        }
        else{
            System.out.println("result="+a+"/"+b);
        }
    }
}